package com.bridgeintelligent.tag.webserver.dim.mgmt.service.dimproperty;

import com.bridgeintelligent.tag.mapper.DictMapper;
import com.bridgeintelligent.tag.mapper.DimPropertyMapper;
import com.bridgeintelligent.tag.webserver.dim.mgmt.api.BaseCode;
import com.bridgeintelligent.tag.webserver.dim.mgmt.api.DimRep;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * Created by JackCheung on 2019/9/15 12:28 PM.
 */
@Service
@AllArgsConstructor
public class DimPropertyService implements IDimPropertyService {

    private DimPropertyMapper dimPropertyMapper;
    private DictMapper dictMapper;

    @Override
    public DimRep dimClassify() {
        return new DimRep<>(dimPropertyMapper.classifyList(), BaseCode.SUCCESS);
    }

    @Override
    public DimRep dimDataSource() {
        return new DimRep<>(dimPropertyMapper.dataSourceList(), BaseCode.SUCCESS);
    }

    @Override
    public DimRep dimShowType() {
        return new DimRep<>(dimPropertyMapper.showRuleList(), BaseCode.SUCCESS);
    }

    @Override
    public DimRep dict(String type) {
        return new DimRep<>(dictMapper.selectByType(type), BaseCode.SUCCESS);
    }
}
